
{{ content() }}

<div class="row">

    <div class="col-md-6">
        <div class="page-header">
            <h2>用户登录</h2>
        </div>
        <form action="javascript:void(0)" method="post" onsubmit="javascript:login();">
            <fieldset>
                <div class="form-group">
                    <label for="email">用户名称/电子邮件</label>
					<div class="controls">
                        <input type="text" id="email" name="email" value="{{ email }}" class="form-control" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <div class="controls">
                        <input type="password" id="password" name="password"  value="{{ password }}" class="form-control" />
                    </div>
                </div>
				<div class="form-group">
                    <input type="submit" value="登录" class="btn btn-primary btn-large" />
                </div>
            </fieldset>
        </form>
    </div>

    <div class="col-md-6">

        <div class="page-header">
            <h2>注册用户</h2>
        </div>

        <p>Create an account offers the following advantages:</p>
        <ul>
            <li>Create, track and export your invoices online</li>
            <li>Gain critical insights into how your business is doing</li>
            <li>Stay informed about promotions and special packages</li>
        </ul>

        <div class="clearfix center">
            <a href= "{{ url("register") }}" class="btn btn-primary btn-large btn-success">注册</a>
        </div>
    </div>

</div>
<script type="text/javascript">
	function login(){
		var email = $("#email").val();
		var password = $("#password").val();

		$.ajax({
				type: "POST",
				url: "{{ url("session/start") }}",
				data: {email:email, password:password},
				dataType: "json",
				success: function(data){
					if(data.status==1){
						window.location.href = data.url;
					}
					else {
						alert (data.message);
					}
				}
		});
	}
</script>
